package com.lsl.controller;

import com.lsl.bean.UserAccount;
import com.lsl.service.UserAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author
 */
@Controller
public class LoginController {

    @Autowired
    private UserAccountService userAccountService;

    @RequestMapping("/userLogin")
    public String login(Model model){

        model.addAttribute("msg","ceca");
        return "userLogin";
    }

    @RequestMapping(value = "/userlogout")
    @ResponseBody
    public String logout(HttpServletRequest request){
        HttpSession session = request.getSession();
        request.getSession().removeAttribute("useraccount");
        return "退出登录";
    }
}
